﻿@model G28BS.Models.UserProfile

@{
    ViewBag.Title = "Breyta notandaupplýsingum";
}

<h2>Breyta notandaupplýsingum</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@section scripts{ <script type="text/javascript" src="~/Javascripts/ListUsers.js"></script> }

@using (Html.BeginForm()) 

{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Notandaupplýsingar</legend>

        @Html.HiddenFor(model => model.UserId)

        <div class="editor-label">
            @Html.LabelFor(model => model.UserId)
        </div>
        <div class="editor-field">
            @Html.DisplayFor(model => model.UserId)
        </div>
        <div id="changepassword">
            <a href="~/Account/Manage/">Breyta aðgangsorði</a>
            @if(Model.UserName != "admin" && Model.UserName != "moderator")
            {
                <a href="~/Account/DeleteMePlease/@Model.UserId" id="deletemeplease">Eyða aðgangi mínum</a>
            }
        </div>
        
        @Html.HiddenFor(model => model.UserName)

        <div class="editor-label">
            @Html.LabelFor(model => model.UserName)
        </div>
        <div class="editor-field">
            @Html.DisplayFor(model => model.UserName)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.userEmail)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.userEmail)
            @Html.ValidationMessageFor(model => model.userEmail)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.userDescription)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.userDescription)
            @Html.ValidationMessageFor(model => model.userDescription)
        </div>
        <p>
            <input type="submit" value="Geyma" /> 
        </p>

    </fieldset>
}
<form action="/account/upload" method="post" enctype="multipart/form-data">
    <div  style="margin:5px; width: 15%">
        <h4>Þín mynd/avatar:</h4>

        @{ string filePath = Request.MapPath("~/Images/Profile/"+ @Model.userImage);}
        @if( System.IO.File.Exists(filePath))
        {
            <img src="~/Images/Profile/@Model.userImage" alt="unable to load image" style="width:100%" />
        }
        else
        {
            <img src="~/Images/avatar.png" alt="unable to load image" style="width:100%" />   
        }
    </div>
    <label for="photo">Skipta um mynd:</label>
    <input name="photo" id="photo" type="file">
 
    <input value="Senda mynd" type="submit">
</form>